﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JDFoodMenu.Framework.Biz
{
    public class BLCalendar
    {
        public static DateTime GetFirstDayOfWeek(DateTime calendarDate)
        {
            string weekday = calendarDate.DayOfWeek.ToString();
            switch (weekday)
            {
                case "Tuesday":
                    return calendarDate.AddDays(-1);
                case "Wednesday":
                    return calendarDate.AddDays(-2);
                case "Thursday":
                    return calendarDate.AddDays(-3);
                case "Friday":
                    return calendarDate.AddDays(-4);
                case "Saturday":
                    return calendarDate.AddDays(-5);
                case "Sunday":
                    return calendarDate.AddDays(-6);
            }
            return calendarDate;
        }

    }
}
